class AppError(Exception):
    def __init__(self, id:str,*args: object) -> None:
        self.id=id
        super().__init__(*args)

class Deck:
    def __init__(self, deck:list, card_width:float, card_height:float, name:str) -> None:
        self.deck = deck
        self.card_width = card_width
        self.card_height = card_height
        self.name = name

    def get_cards(self):
        for card, count in self.deck:
            for i in range(count):
                yield card

def hash(args,kwargs):
    args = list(args)
    kwargs = list(kwargs.items())
    return tuple(args+kwargs)

def cached(f):
    cache = {}
    def wrapped(*args,**kwargs):
        h = hash(args, kwargs)
        c = cache.get(h, None)
        if c: return c
        r = f(*args, **kwargs)
        cache[h]=r
        return r
    return wrapped
